package com.iot.manage.service;

import com.alibaba.fastjson.JSONObject;
import com.iot.manage.dao.DPropertyMapper;
import com.iot.manage.pojo.DeviceProperty;
import com.iot.manage.pojo.SysCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DPropertyService {

    @Autowired
    private DPropertyMapper dPropertyMapperMapper;

    public List<DeviceProperty> findDPropertyList(String query, int pagenum, int pagesize) {
        return dPropertyMapperMapper.findDPropertyList(query,pagesize * (pagenum - 1),pagesize * pagenum);
    }

    public int countDPropertyList(String query) {
        return dPropertyMapperMapper.countDPropertyList(query);
    }

    public void addDevicePropertyInfo(JSONObject params) {
        dPropertyMapperMapper.addDevicePropertyInfo(params);
    }

    public DeviceProperty findDevicePropertyInfoByIdOrCode(String params) {
        return dPropertyMapperMapper.findDevicePropertyInfoByIdOrCode(params);
    }

    public void updateDevicePropertyInfo(JSONObject params) {
        dPropertyMapperMapper.updateDevicePropertyInfo(params);
    }

    public void deleteDPropertyInfo(String dpropertyId) {
        dPropertyMapperMapper.deleteDPropertyInfo(dpropertyId);
    }

    public List<SysCode> findDPropertyTypeList() {
        return dPropertyMapperMapper.findDPropertyTypeList();
    }

    public List<SysCode> findDPropertyUnitList() {
        return dPropertyMapperMapper.findDPropertyUnitList();
    }

    public int countPropertyUseTotal(String propertyCode) {
        return dPropertyMapperMapper.countPropertyUseTotal(propertyCode);
    }

    public void updateDeviceModelArg(JSONObject params) {
        dPropertyMapperMapper.updateDeviceModelArg(params);
    }
}
